﻿<%@ Page Title="总分相关（整体）" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ClassMacroReport.aspx.cs" Inherits="ExamAnalysis.Reports.ClassMacroReport" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        var percent = function (value) {
            return value + "%";
        };

        var submitValue = function (grid, hiddenFormat, format) {
            hiddenFormat.setValue(format);
            grid.submitData(false, { isUpload: true });
        };
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <ext:Hidden ID="FormatType" runat="server" />
    <ext:GridPanel 
        ID="GridPanel"
        runat="server" 
        Title="年级考试总体情况分析表" 
        ColumnLines="true"
        Height="500">
        <TopBar>
            <ext:Toolbar runat="server">
                <Items>
           
                    <ext:Label Text="选择科目："  runat="server" />
                    <ext:ComboBox 
                        ID="TargetList" 
                        Width="200" 
                        runat="server"
                        DisplayField="Text" 
                        ValueField="Value">
                        <Store>
                            <ext:Store runat="server" ID="TargetStore">
                                <Model>
                                    <ext:Model runat="server" IDProperty="Value">
                                        <Fields>
                                            <ext:ModelField Name="Text" />
                                            <ext:ModelField Name="Value" />
                                            <ext:ModelField Name="Type" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                    </ext:ComboBox>
                    <ext:Label Text="选择班级：" runat="server" />
                    <ext:DropDownField ID="ClassList" Editable="false" runat="server" Text="全部">
                        <Component>
                            <ext:GridPanel ID="ClassGrid" Width="200" runat="server" ForceFit="true">
                                <Store>
                                    <ext:Store ID="ClassStore" runat="server" GroupField="ClassGrade">
                                        <Model>
                                            <ext:Model runat="server" IDProperty="ClassID">
                                                <Fields>
                                                    <ext:ModelField Name="ClassID" />
                                                    <ext:ModelField Name="ClassCode" />
                                                    <ext:ModelField Name="ClassName" />
                                                    <ext:ModelField Name="ClassType" />
                                                    <ext:ModelField Name="ClassGrade" />
                                                    <ext:ModelField Name="ClassAliasName" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                        <Sorters>
                                            <ext:DataSorter Property="ClassID" Direction="ASC" />
                                        </Sorters>
                                    </ext:Store>                                   
                                </Store>
                                <ColumnModel runat="server">
                                    <Columns>
                                        <ext:Column runat="server" Text="班级" DataIndex="ClassAliasName" />
                                        <ext:Column runat="server" Text="类型" DataIndex="ClassType" />
                                    </Columns>
                                </ColumnModel>
                                <View>
                                    <ext:GridView runat="server" LoadMask="true" />
                                </View>
                                <SelectionModel>
                                    <ext:RowSelectionModel runat="server" Mode="Multi" />
                                </SelectionModel>
                                <Features>
                                    <ext:Grouping 
                                        runat="server" 
                                        HideGroupedHeader="true" 
                                        StartCollapsed="true" 
                                        GroupHeaderTplString="年级：{name} {rows.length}个班"
                                        />
                                </Features>
                                <Listeners>
                                    <SelectionChange Handler="this.dropDownField.setValue('自定义', false);" />
                                </Listeners>
                            </ext:GridPanel>
                        </Component>
                    </ext:DropDownField>
                    <ext:Label Text="学生类别：" runat="server" />
                    <ext:ComboBox ID="StudentType" Editable="false" Text="请选择" runat="server">
                        <Items>
                            <ext:ListItem Text="全部"></ext:ListItem>
                            <ext:ListItem Text="普通生"></ext:ListItem>
                            <ext:ListItem Text="住读生"></ext:ListItem>
                            <ext:ListItem Text="走读生"></ext:ListItem>
                        </Items>
                        <SelectedItems>
                            <ext:ListItem Text="全部"></ext:ListItem>
                        </SelectedItems>
                    </ext:ComboBox>
                    <ext:Button Text="生成" Icon="Accept" runat="server">
                        <DirectEvents>
                            <Click OnEvent="SubmitButton_Click" Timeout="60000"  />
                        </DirectEvents>
                    </ext:Button>
                    <ext:Button Text="保存" AutoPostBack="true" Icon="Disk" runat="server">
                        <Listeners>
                            <Click Handler="submitValue(#{GridPanel}, #{FormatType}, 'xls');" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button Text="打印" Icon="Printer" runat="server">
                        <Listeners>
                            <Click Handler="javascript:window.print();" />
                        </Listeners>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <Store>
            <ext:Store ID="ReportStore" runat="server" OnSubmitData="Store_Submit">
                <Model>
                    <ext:Model runat="server">
                        <Fields>
                            <ext:ModelField Name="ExamItemsGroupID" Type="Int" />
                            <ext:ModelField Name="ClassID" Type="Int" />
                            <ext:ModelField Name="ClassName" Type="String" />
                            <ext:ModelField Name="TheoryStudentCount" Type="Int" />
                            <ext:ModelField Name="ActualStudentsCount" Type="Int" />
                            <ext:ModelField Name="MaxScore" Type="Float" />
                            <ext:ModelField Name="MinScore" Type="Float" />
                            <ext:ModelField Name="AvgScore" Type="Float" />
                            <ext:ModelField Name="StdScore" Type="Float" />
                            <ext:ModelField Name="MADScore" Type="Float" />
                            <ext:ModelField Name="AvgScoreRank" Type="Int" />
                            <ext:ModelField Name="ExcellentRatio" Type="Float" />
                            <ext:ModelField Name="ExcellentRatioRank" Type="Int" />
                            <ext:ModelField Name="PassRatio" Type="Float" />
                            <ext:ModelField Name="PassRatioRank" Type="Int" />
                            <ext:ModelField Name="LowRatio" Type="Float" />
                            <ext:ModelField Name="LowRatioRank" Type="Int" />
                            <ext:ModelField Name="QuartileScore1" Type="Float" />
                            <ext:ModelField Name="QuartileScore3" Type="Float" />
                            <ext:ModelField Name="MedianScore" Type="Float" />
                            <ext:ModelField Name="Count1" Type="Int" />
                            <ext:ModelField Name="Count2" Type="Int" />
                            <ext:ModelField Name="Count3" Type="Int" />
                            <ext:ModelField Name="Count4" Type="Int" />
                            <ext:ModelField Name="Count5" Type="Int" />
                            <ext:ModelField Name="ScoreRate" Type="Float" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
        </Store>
        <ColumnModel runat="server">
            <Columns>
                <ext:Column runat="server" Text="班级" Width="80" DataIndex="ClassName"/>
                <ext:Column runat="server" Text="应试<br/>人数" Width="40" 
                    DataIndex="TheoryStudentCount" Align="Center" />
                <ext:Column runat="server" Text="考试<br/>人数" Width="40" 
                    DataIndex="ActualStudentsCount" Align="Center" />
                <ext:Column runat="server" Text="总分、科目组合、各科、分卷">
                    <Columns>
                        <ext:Column runat="server" Align="Center" Text="最高分" Width="50" DataIndex="MaxScore" Sortable="true" />
                        <ext:Column runat="server" Align="Center" Text="最低分" Width="50" DataIndex="MinScore" Sortable="true" />
                        <ext:Column runat="server" Text="平均分">
                            <Columns>
                                <ext:Column runat="server" Align="Center" Text="分值" Width="40" DataIndex="AvgScore" Sortable="true" />
                                <ext:Column runat="server" Align="Center" Text="标准差" Width="50" DataIndex="StdScore"  Sortable="true" />
                                <ext:Column runat="server" Align="Center" Text="均值<br/>差异" Width="50" DataIndex="MADScore" Sortable="true" />
                                <ext:Column runat="server" Align="Center" Text="年级<br/>排名" Width="40" DataIndex="AvgScoreRank" Sortable="true" />
                            </Columns>
                        </ext:Column>
                        <ext:Column runat="server" Text="优秀率">
                            <Columns>
                                <ext:Column runat="server" Align="Center" Text="比率" Width="40" DataIndex="ExcellentRatio" Sortable="true">
                                    <Renderer Fn="percent" />
                                </ext:Column>
                                <ext:Column runat="server" Align="Center" Text="年级<br/>排名" Width="40" DataIndex="ExcellentRatioRank" Sortable="true" />
                            </Columns>
                        </ext:Column>
                        <ext:Column runat="server" Text="及格率">
                            <Columns>
                                <ext:Column runat="server" Align="Center" Text="比率" Width="40" DataIndex="PassRatio" Sortable="true">
                                    <Renderer Fn="percent" />
                                </ext:Column>
                                <ext:Column runat="server" Align="Center" Text="年级<br/>排名" Width="40" DataIndex="PassRatioRank" Sortable="true" />
                            </Columns>
                        </ext:Column>
                        <ext:Column runat="server" Text="低分率">
                            <Columns>
                                <ext:Column runat="server" Align="Center" Text="比率" Width="40" DataIndex="LowRatio" Sortable="true">
                                    <Renderer Fn="percent" />
                                </ext:Column>
                                <ext:Column runat="server" Align="Center" Text="年级<br/>排名" Width="40" DataIndex="LowRatioRank" Sortable="true" />
                            </Columns>
                        </ext:Column>
                        <ext:Column runat="server" Text="四分位">
                            <Columns>
                                <ext:Column runat="server" Text="第一<br/>四分位数" Align="Center" Width="60" DataIndex="QuartileScore1"  Sortable="true" />
                                <ext:Column runat="server" Text="中位数" Width="50" Align="Center" DataIndex="MedianScore" Sortable="true" />
                                <ext:Column runat="server" Text="第三<br/>四分位数" Align="Center" Width="60" DataIndex="QuartileScore3" Sortable="true" />
                            </Columns>
                        </ext:Column>
                    </Columns>
                </ext:Column>
                <ext:Column runat="server" Text="年级、班级、各分数段<br/>人数分布" Sortable="true" >
                    <Columns>
                        <ext:Column runat="server" Text="0-59" Align="Center" Width="40" DataIndex="Count1" Sortable="true"   />
                        <ext:Column runat="server" Text="60-69" Align="Center" Width="40"  DataIndex="Count2" Sortable="true" />
                        <ext:Column runat="server" Text="70-79" Align="Center" Width="40" DataIndex="Count3" Sortable="true" />
                        <ext:Column runat="server" Text="80-89" Align="Center" Width="40" DataIndex="Count4" Sortable="true" />
                        <ext:Column runat="server" Text="90-100" Align="Center" Width="40" DataIndex="Count5" Sortable="true" />
                    </Columns>
                </ext:Column>
            </Columns>
        </ColumnModel>
        <BottomBar>
            <ext:StatusBar>
                <Items>
                <ext:Chart runat="server" Width="800" Height="250">
                        <Store>
                            <ext:Store ID="ChartStore" runat="server" 
                                Shadow="true" Animate="true" 
                                AutoDataBind="true">                           
                                <Model>
                                    <ext:Model runat="server">
                                        <Fields>
                                            <ext:ModelField Name="ExamItemsGroupID" Type="Int" />
                                            <ext:ModelField Name="ClassID" Type="Int" />
                                            <ext:ModelField Name="ClassName" Type="String" />
                                            <ext:ModelField Name="TheoryStudentCount" Type="Int" />
                                            <ext:ModelField Name="ActualStudentsCount" Type="Int" />
                                            <ext:ModelField Name="MaxScore" Type="Float" />
                                            <ext:ModelField Name="MinScore" Type="Float" />
                                            <ext:ModelField Name="AvgScore" Type="Float" />
                                            <ext:ModelField Name="StdScore" Type="Float" />
                                            <ext:ModelField Name="MADScore" Type="Float" />
                                            <ext:ModelField Name="AvgScoreRank" Type="Int" />
                                            <ext:ModelField Name="ExcellentRatio" Type="Float" />
                                            <ext:ModelField Name="ExcellentRatioRank" Type="Int" />
                                            <ext:ModelField Name="PassRatio" Type="Float" />
                                            <ext:ModelField Name="PassRatioRank" Type="Int" />
                                            <ext:ModelField Name="LowRatio" Type="Float" />
                                            <ext:ModelField Name="LowRatioRank" Type="Int" />
                                            <ext:ModelField Name="QuartileScore1" Type="Float" />
                                            <ext:ModelField Name="QuartileScore3" Type="Float" />
                                            <ext:ModelField Name="MedianScore" Type="Float" />
                                            <ext:ModelField Name="StandardizedScore" Type="Float" />
                                            <ext:ModelField Name="ScoreRate" Type="Float" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                        <Axes>
                            <ext:NumericAxis                             
                                Fields="ScoreRate"                            
                                Grid="true"
                                Title="平均分"
                                Minimum="40" Maximum="100">
                            </ext:NumericAxis> 
                            <ext:CategoryAxis 
                                Position="Bottom"
                                Fields="ClassName"
                                Title="班级">
                                <Label Font="9px Arial">
                                    <Rotate Degrees="270" />
                                </Label>
                            </ext:CategoryAxis>      
                        </Axes>
                        <Series>
                            <ext:ColumnSeries 
                                Axis="Left"
                                Highlight="true" 
                                XField="ClassName" 
                                YField="ScoreRate">
                                <Style Fill="#456d9f" />
                                <HighlightConfig Fill="#a2b5ca" />
                                <Label 
                                    Contrast="true" 
                                    Display="InsideEnd" 
                                    Field="ScoreRate"
                                    Color="#000" 
                                    Orientation="Vertical" 
                                    TextAnchor="middle"
                                    />
                            </ext:ColumnSeries>
                        </Series>
                    </ext:Chart>
                    <ext:ToolbarFill />
                </Items>
            </ext:StatusBar>
        </BottomBar>
    </ext:GridPanel>
</asp:Content>
